/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package qlnhahang_tieccuoi;

import java.awt.Dimension;
import java.awt.Label;
import java.util.ArrayList;
import java.util.Locale;
import javax.swing.*;

/**
 *
 * @author SaraPhan
 */
public class jMenu extends javax.swing.JFrame {

    /**
     * Creates new form jMenu
     */
    private ArrayList<String> titles;
    private int flag = 0;
    private int index = 0;
    
    public jMenu() {
        initComponents();
        this.jmiDangNhap.setEnabled(true);
        this.jmiDangXuat.setEnabled(false);
        this.jmKhacHang.setEnabled(false);
        titles = new ArrayList<String>();
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jLayeredPane1 = new javax.swing.JLayeredPane();
        jHeader = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        jlbl_chucNangTongQuat = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jMain = new javax.swing.JPanel();
        jXStatusBar2 = new org.jdesktop.swingx.JXStatusBar();
        jLabel2 = new javax.swing.JLabel();
        jclosedPanbel = new org.xnap.commons.gui.CloseableTabbedPane();
        jMenuBar1 = new javax.swing.JMenuBar();
        jmiHeThong = new javax.swing.JMenu();
        jmiDangNhap = new javax.swing.JMenuItem();
        jmiDangXuat = new javax.swing.JMenuItem();
        jmKhacHang = new javax.swing.JMenu();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        jLabel1.setFont(new java.awt.Font("Times New Roman", 0, 18)); // NOI18N
        jLabel1.setForeground(new java.awt.Color(204, 0, 0));
        jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel1.setText("Chức năng chi tiết");

        jlbl_chucNangTongQuat.setBackground(new java.awt.Color(255, 0, 0));
        jlbl_chucNangTongQuat.setFont(new java.awt.Font("Times New Roman", 0, 18)); // NOI18N
        jlbl_chucNangTongQuat.setForeground(new java.awt.Color(204, 0, 0));
        jlbl_chucNangTongQuat.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jlbl_chucNangTongQuat.setText("Chức năng tổng quát");

        jLabel3.setFont(new java.awt.Font("Times New Roman", 0, 18)); // NOI18N
        jLabel3.setForeground(new java.awt.Color(204, 0, 0));
        jLabel3.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel3.setText("Báo cáo");

        javax.swing.GroupLayout jHeaderLayout = new javax.swing.GroupLayout(jHeader);
        jHeader.setLayout(jHeaderLayout);
        jHeaderLayout.setHorizontalGroup(
            jHeaderLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jHeaderLayout.createSequentialGroup()
                .addComponent(jlbl_chucNangTongQuat, javax.swing.GroupLayout.PREFERRED_SIZE, 177, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 127, javax.swing.GroupLayout.PREFERRED_SIZE))
        );
        jHeaderLayout.setVerticalGroup(
            jHeaderLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jLabel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addComponent(jlbl_chucNangTongQuat, javax.swing.GroupLayout.DEFAULT_SIZE, 33, Short.MAX_VALUE)
        );

        jMain.setBorder(javax.swing.BorderFactory.createMatteBorder(1, 1, 1, 1, new java.awt.Color(153, 0, 0)));

        jLabel2.setFont(new java.awt.Font("Times New Roman", 1, 12)); // NOI18N
        jLabel2.setText("QLNHTC V.01 Design By HaiPM");
        jXStatusBar2.add(jLabel2);

        javax.swing.GroupLayout jMainLayout = new javax.swing.GroupLayout(jMain);
        jMain.setLayout(jMainLayout);
        jMainLayout.setHorizontalGroup(
            jMainLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jXStatusBar2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addComponent(jclosedPanbel, javax.swing.GroupLayout.DEFAULT_SIZE, 1313, Short.MAX_VALUE)
        );
        jMainLayout.setVerticalGroup(
            jMainLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jMainLayout.createSequentialGroup()
                .addComponent(jclosedPanbel, javax.swing.GroupLayout.PREFERRED_SIZE, 612, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(jXStatusBar2, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE))
        );

        jclosedPanbel.getAccessibleContext().setAccessibleName("");

        jMenuBar1.setBackground(new java.awt.Color(255, 0, 0));
        jMenuBar1.setForeground(new java.awt.Color(255, 0, 0));
        jMenuBar1.setMinimumSize(new java.awt.Dimension(0, 5));
        jMenuBar1.setPreferredSize(new java.awt.Dimension(136, 30));

        jmiHeThong.setText("Hệ Thống");
        jmiHeThong.setFont(new java.awt.Font("Segoe UI", 0, 14)); // NOI18N

        jmiDangNhap.setText("Đăng Nhập");
        jmiDangNhap.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jmiDangNhapActionPerformed(evt);
            }
        });
        jmiHeThong.add(jmiDangNhap);

        jmiDangXuat.setText("Đăng Xuất");
        jmiDangXuat.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jmiDangXuatActionPerformed(evt);
            }
        });
        jmiHeThong.add(jmiDangXuat);

        jMenuBar1.add(jmiHeThong);

        jmKhacHang.setText("Khách Hàng");
        jmKhacHang.setFont(new java.awt.Font("Segoe UI", 0, 14)); // NOI18N
        jmKhacHang.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jmKhacHangMouseClicked(evt);
            }
        });
        jMenuBar1.add(jmKhacHang);

        setJMenuBar(jMenuBar1);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jHeader, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addComponent(jMain, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(jHeader, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jMain, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jmKhacHangMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jmKhacHangMouseClicked
        // TODO add your handling code here:
        //this.jlbl_main.setVisible(true);
    }//GEN-LAST:event_jmKhacHangMouseClicked

    private void jmiDangNhapActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jmiDangNhapActionPerformed
        // TODO add your handling code here:
        jDialogDangNhap frm = new jDialogDangNhap(this, true);
        frm.setVisible(true);
        
        if (frm.isKetQuaDangNhap() == true) {
            this.jmiDangNhap.setEnabled(false);
            this.jmiDangXuat.setEnabled(true);
            this.jmKhacHang.setEnabled(true);
        }
        else{
            this.jmiDangNhap.setEnabled(true);
            this.jmiDangXuat.setEnabled(false);
            this.jmKhacHang.setEnabled(false);
        }
    }//GEN-LAST:event_jmiDangNhapActionPerformed

    private void jmiDangXuatActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jmiDangXuatActionPerformed
        // TODO add your handling code here:
        this.jmiDangNhap.setEnabled(true);
        this.jmiDangXuat.setEnabled(false);        
        this.jmKhacHang.setEnabled(false);
    }//GEN-LAST:event_jmiDangXuatActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /*
         * Set the Nimbus look and feel
         */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /*
         * If Nimbus (introduced in Java SE 6) is not available, stay with the
         * default look and feel. For details see
         * http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(jMenu.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(jMenu.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(jMenu.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(jMenu.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /*
         * Create and display the form
         */
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                new jMenu().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JPanel jHeader;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLayeredPane jLayeredPane1;
    private javax.swing.JPanel jMain;
    private javax.swing.JMenuBar jMenuBar1;
    private org.jdesktop.swingx.JXStatusBar jXStatusBar2;
    private org.xnap.commons.gui.CloseableTabbedPane jclosedPanbel;
    private javax.swing.JLabel jlbl_chucNangTongQuat;
    private javax.swing.JMenu jmKhacHang;
    private javax.swing.JMenuItem jmiDangNhap;
    private javax.swing.JMenuItem jmiDangXuat;
    private javax.swing.JMenu jmiHeThong;
    // End of variables declaration//GEN-END:variables
}
